﻿using System;

namespace ZYCommon
{
    

    public class Format_MaxLength : StringDataFormatItem
    {
        public override bool CanEditSetting()
        {
            return true;
        }

        public override bool Test(string strValue)
        {
            if (strValue != null)
            {
                return (strValue.Length <= Convert.ToInt32(base.strSetting));
            }
            return true;
        }

        public override string DisplayName
        {
            get
            {
                return ("不得超过 " + base.strSetting + " 个字符");
            }
        }

        public override string Name
        {
            get
            {
                return "maxlength";
            }
        }

        public override string SettingValue
        {
            get
            {
                return base.strSetting;
            }
            set
            {
                try
                {
                    Convert.ToInt32(value);
                    base.strSetting = value;
                }
                catch
                {
                }
            }
        }
    }
}

